home *** CD-ROM | disk | FTP | other *** search
- /* (c) 1990 S.Hawtin.
- Permission is granted to copy this file provided
- 1) It is not used for commercial gain
- 2) This notice is included in all copies
- 3) Altered copies are marked as such
-
- No liability is accepted for the contents of the file.
-
- */
-
- #include <stdio.h>
- #include <libraries/dos.h>
-
- typedef void *lockPtr;
-
- extern lockPtr CurrentDir();
- extern lockPtr Lock();
-
- static struct FileInfoBlock mydata;
-
- findDirs(dir,disk,length)
- char *dir;
- char *disk;
- int length;
- {/* Work out the name of the current directory */
-
- lockPtr current;
- lockPtr parent,wasparent;
- int first;
-
- *dir = '\0';
- first = 1;
- parent = Lock("/",ACCESS_READ);
- while(parent!=NULL)
- {
- wasparent = CurrentDir(parent);
-
- Examine(wasparent,&mydata);
- strcpy(disk,dir);
- strcpy(dir,mydata.fib_FileName);
- strcat(dir,"/");
- strcat(dir,disk);
-
- if(first)
- {current = wasparent;
- first = 0;
- }
- else
- {
- UnLock(wasparent);
- }
- parent = Lock("/",ACCESS_READ);
- }
-
- /* We must be at the root of the disk */
- if(first)
- {/* We were at the root of the disk already! */
- wasparent = Lock(":",ACCESS_READ);
- }
- else
- wasparent = CurrentDir(current);
-
- Examine(wasparent,&mydata);
-
- strcpy(disk,dir);
- strcpy(dir,mydata.fib_FileName);
- strcat(dir,":");
- strcat(dir,disk);
- strcpy(disk,mydata.fib_FileName);
- strcat(disk,":");
-
- UnLock(wasparent);
- }
-
-